The solution is to put the part of the mouse cursor only in the Start and like this: void Start () { Cursor.lockState = CursorLockMode.Locked; Cursor.lockState ...
A locked cursor is positioned in the center of the view and cannot be moved. The cursor is invisible in this state, regardless of the value of Cursor.visible.
How the cursor should behave. These are various modes that control the behaviour of the Cursor. A default cursor must be set in PlayerSettings > Default Cursor.